
--创建Node包装器
--New 默认的根节点 root
local function MClass(name)
	local cls = {}
	cls._name = name
	cls.__index = function(tb,fName)
		cls._findSth = cls[fName]
		if cls._findSth then
            return cls._findSth
        end
        cls._findSth = tb.root[fName]
        if cls._findSth then
        	cls._callType = type(cls._findSth)
		    if cls._callType == "function" then
		    	cls._exeFuncName = fName
		    	if not cls._exeFunc then
			    	cls._exeFunc = function(tb,...)
						if not cc.isDead(tb.root) then
	                		return tb.root[cls._exeFuncName](tb.root,...)
						end
	            	end
            	end
            	return cls._exeFunc
		    else
		    	return cls._findSth
		    end
        end
	end

	cls.new = function(root,...)
		assert(root)
		local obj = {}
		obj._super = cls
		obj.root = root
		setmetatable(obj,cls)
		obj:ctor(...)
		return obj
	end

	return cls
end

return MClass